#-------------------------------------------------------------------------------
# Name:        Light
# Purpose:
#
# Author:      Michael Blackwood
#
# Created:     25/11/2013
# Copyright:   (c) Monxcleyr Productions 2013
# Licence:     GPL v3
#-------------------------------------------------------------------------------
#!/usr/bin/env python

import pygame, logging

import animatedsprite

class Light(animatedsprite.AnimatedSprite):

  """ Lights. the attribute 'warning' sets if the light is a warning light to only be shown
      during emergencies. """

  def __init__(self, objtype, name, attributes, imagehandler):
    animatedsprite.AnimatedSprite.__init__(self, objtype, name, attributes, imagehandler)
    self.ancestors.append('light')
    self.attributes['warning'] = self.attributes['warning'] == 'True'



  def update(self, common, computer):

    if self.attributes['warning']:
      if computer.emergency['running'] == True:
        self.attributes['visable'] = True
      else:
        self.attributes['visable'] = False

    self._animupdate(common)